package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import com.boot.security.server.model.mffl.Vo.MfflServiceVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflService;

@Mapper
public interface MfflServiceDao {

    @Select("select * from mffl_service t where t.id = #{id}")
    MfflServiceVo getById(Long id);


    @Delete("update mffl_service SET DeleteState = 0 WHERE id = #{id}")
    int delete(Long id);

    int update(MfflService mfflService);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_service(name, content, islawyer, order, createTime, updateTime, delete_state, deleteTime, money,days,points,computingUnit,maximumMoney,minimumMoney,confirmTime,RefuseTime) values(#{name}, #{content}, #{islawyer}, #{order}, #{createTime}, #{updateTime}, #{deleteState}, #{deleteTime}, #{money},#{days},#{points},#{computingUnit},#{maximumMoney},#{minimumMoney},#{confirmTime},#{RefuseTime})")
    int save(MfflService mfflService);
    
    int count(@Param("params") Map<String, Object> params);

    List<MfflService> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    @Select("SELECT * FROM mffl_service t WHERE t.islawyer = 1 AND toconfigure = 1  ORDER BY `order` ASC")
    List<MfflService> getLawyerServiceList();


    @Select("select * from mffl_service t where t.id = #{id}")
    MfflService getByServiceId(Long id);
}
